import request from "./request"

// 发送验证码
export function sendVerifyCode(data){
    return request({
        url: '/echo/user/requestVerifyCode',
        method: 'post',
        data
    })
}

// 获取当前用户信息
export function getCurrentUser(){
    return request({
        url: '/echo/user/getCurrentUserInfo',
        method: 'get',
        headers: {
            "Authorization":localStorage.getItem("Authorization")
        }
    })
}

// 激活账号
export function active(data){
    return request({
        url: '/echo/user/active',
        method: 'post',
        data
    })
}

// 登录
export function login(data){
    return request({
        url: '/echo/user/login',
        method: 'post',
        data
    })
}

// 关注
export function following(userId){
    return request({
        url:'/echo/user/following/'+userId,
        method:'get',
        headers:{
            "Authorization":localStorage.getItem("Authorization")
        }
    })
}

// 检查是否关注
export function checkFollowing(userId){
    return request({
        url:'/echo/user/following/check/'+userId,
        method:'get',
        headers:{
            "Authorization":localStorage.getItem("Authorization")
        }
    })
}

// 获取关注列表
export function getFollowingList(data){
    return request({
        url:'/echo/user/getFollowingInfo',
        method:'post',
        data:data,
        headers:{
            "Authorization":localStorage.getItem("Authorization")
        }
    })
}

// 获取粉丝列表
export function getFansList(data){
    return request({
        url:'/echo/user/getFans',
        method:'post',
        data:data,
        headers:{
            "Authorization":localStorage.getItem("Authorization")
        }
    })
}

// 根据id查询
export function getUserById(id){
    return request({
        url:'/echo/user/get/'+ id,
        method:'get',
    })
}

// 更新用户
export function updateUser(data){
    return request({
        url:'/echo/user/update',
        data,
        method:'post',
        headers:{
            "Authorization":localStorage.getItem("Authorization")
        }
    })
}

// 重置密码
export function resetPassword(data){
    return request({
        url:'/echo/user/password/reset',
        data,
        method:'post',
        headers:{
            "Authorization":localStorage.getItem("Authorization")
        }
    })
}

// 上传头像
export function uploadAvatar(avatar){
    return request({
        url:'/echo/user/avatar',
        method:'post',
        headers:{
            "Authorization":localStorage.getItem("Authorization"),
            "Content-Type":"multipart/form-data"
        },
        avatar
    })
}


// 上传头像
export function findPwd(data){
    return request({
        url:'/echo/user/findPassword',
        method:'post',
        data
    })
}